﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZDSoft.UPMS.Web.Tools.CheckCode;
namespace ZDSoft.UPMS.Web.Controllers
{
    public class CommonController : Controller
    {
        //
        // GET: /Common/
        /// <summary>
        /// 生成验证码图像对象
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCheckCode()
        {

            CheckCode vCode = new CheckCode();
            string code = vCode.CreateValidateCode(4);
            Session["CheckCode"] = code;
            byte[] bytes = vCode.CreateValidateGraphic(code);
            return File(bytes, @"image/jpeg");
        }
        /// <summary>
        /// 得到当前验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCurrentCheckCode()
        {
            return Content(Session["CheckCode"].ToString());
        }

    }
}
